import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

//import '../form.dart';

class CategoryPage extends StatelessWidget {
  final bool disable = false;

  //设置按钮是否禁用
  dynamic setdisable(context) {
    if (disable) {
      return null;
    }
    return () {
      Navigator.pushNamed(context, '/form', arguments: {"id": 123});
    };
  }

  //RaisedButton  FlatButton OutlineButton
  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      padding: EdgeInsets.all(30.0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.stretch,
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Container(
            height: 50,
            margin: EdgeInsets.fromLTRB(0, 0, 0, 10),
            child: RaisedButton(
                child: Text("跳转到表单页面"),
                color: Colors.yellow,
                textColor: Colors.black,
                disabledTextColor: Colors.black38,
                disabledColor: Colors.black12,
                onPressed: setdisable(context)),
          ),
          Container(
            height: 50,
            margin: EdgeInsets.fromLTRB(0, 0, 0, 10),
            child: FlatButton(
                child: Text("跳转到表单页面"),
                color: Colors.yellow,
                textColor: Colors.black,
                disabledTextColor: Colors.black38,
                disabledColor: Colors.black12,
                onPressed: setdisable(context)),
          ),
          Container(
            height: 50,
            margin: EdgeInsets.fromLTRB(0, 0, 0, 10),
            child: FlatButton(
                child: Text("跳转到表单页面"),
                color: Colors.yellow,
                textColor: Colors.blue,
                disabledTextColor: Colors.black38,
                disabledColor: Colors.black12,
                splashColor: Colors.yellow,
                shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(8)),
                onPressed: setdisable(context)),
          ),
          Container(
            height: 80,
            margin: EdgeInsets.fromLTRB(0, 0, 0, 10),
            child: RaisedButton(
                child: Text("跳转"),
                color: Colors.yellow,
                textColor: Colors.blue,
                disabledTextColor: Colors.black38,
                disabledColor: Colors.black12,
                shape: CircleBorder(side: BorderSide(color: Colors.white)),
                onPressed: setdisable(context)),
          ),
          OutlineButton(
              child: Text("跳转"),
              //color: Colors.yellow, 没效果背景颜色
              textColor: Colors.blue,
              disabledTextColor: Colors.black38,
              //disabledColor: Colors.black12,
              // shape:CircleBorder(
              //   side: BorderSide(color: Colors.white)
              // ),
              onPressed: setdisable(context)
          ),
          FlatButton.icon(
            icon: Icon(Icons.home,size: 20.0,semanticLabel: "111",),
            label:Text("图标按钮"),
             color: Colors.yellow,
                textColor: Colors.blue,
                disabledTextColor: Colors.black38,
                disabledColor: Colors.black12,
            onPressed: setdisable(context)
          )
        ],
      ),
    );
  }
}
